package com.axend.aerosense.common.connect.bean;

import java.util.Map;

/**
 * 蓝牙消息tag
 */
public enum BleMsgTag {

    SET_STATUS(-1, "设置参数状态（成功/失败）"),

    //IP和端口格式：[ip,port]
    SET_SERVER_INFO(1, "设置服务器IP和端口"),
    //WIFI账号和密码格式：(ssid,password)
    SET_NETWORK_INFO(2, "设置WIFI账号和密码"),


    GET_DEVICE_ID(3, (short) 0x0410, "获取设备ID"),
    RESET_DEVICE(4, (short) 0x0411,"重启设备"),
    ;

    int type;
    short tag;
    String name;

    BleMsgTag(int type, String name) {
        this(type, (short) -1, name);
    }

    BleMsgTag(int type, short tag, String name) {
        this.type = type;
        this.tag = tag;
        this.name = name;
    }

    public static BleMsgTag fromTag(short tag){
        for (BleMsgTag value : values()) {
            if (tag == value.tag) {
                return value;
            }
        }

        return null;
    }

    @Override
    public String toString() {
        return "BleMsgTag{" +
                "type=" + type +
                ", name='" + name + '\'' +
                '}';
    }
}
